package org.thesis.activity;

import org.thesis.R;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
//class gioi thieu ve Esafe
public class IntroduceActivity extends Activity
{
	MediaPlayer mp;  //choi nhac
	Boolean check_firstLogin = false;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(org.thesis.R.layout.introduce);
		startMusic();
		
		
		org.thesis.dataAccess.DB_EmailLoginManager_Adapter mydb = new org.thesis.dataAccess.DB_EmailLoginManager_Adapter(this);
        mydb.open();
        Cursor mCursor = mydb.get_email_tongmail_newmail();
        if(mCursor.getCount() == 0) // neu CSDL trong
        	check_firstLogin = true;
        mCursor.close();
        mydb.close();
	}
	public void img_onClick(View v)
	{
		ImageButton btn = (ImageButton)v;
		switch (btn.getId()) {
		case R.id.img_intro_next:
			Log.v("introduce", "next");
			if(check_firstLogin)
			{
				startActivity(new Intent(this, org.thesis.activity.loginActivity.class));
			}
			else
			{
				startActivity(new Intent(this, org.thesis.activity.ListMailActivity.class));
			}
			break;

		default:
			break;
		}
	}
	public void startMusic()
    {
    	mp = MediaPlayer.create(getBaseContext(), R.raw.btn_click);
    	mp.start();
    }
}
